import pygame
import sys

pygame.init()
size=width,height = 600,600
screen = pygame.display.set_mode(size)
bg=(255,255,255)
while True:
    for event in pygame.event.get():
        with open('text.txt','a')as f:
            f.write(str(event)+'\n')
        if event.type == pygame.QUIT:
            sys.exit()


screen.fill(bg)
pygame.display.flip()
pygame.time.delay(10)
